<? 
	$title="User List"; 
	$pageid="4";
	$accessid=",a10,";

	if(isset($_POST['btnsubmit']))
	{
		require("required/dbconnect.php");
		
		$cuisine=$_POST['category'];
		$insert=mysql_query("insert into po_category(name)value('$category')")or die(mysql_error());
		header("Location:category_management.php");
	}

	require("required/dbconnect.php"); 
	require("required/function.php");
	require("required/header.php");
	
	
	
	$get_category=mysql_query("select * from po_category order by name asc");
	
	
?>
<table width="71%" class="solidborder" cellpadding="2" cellspacing="1">
<tr>
		<td height="20" colspan="2" align="left" style="background: url(images/tbl_th.png);color:#FFFFFF" >
			<font color="#FFFFFF"><strong>Category Management</strong></font>
		</td>
	</tr>
	<tr>
		<td>
			<table width="100%">
				<tr style="background-image: url(images/tbl_th.png);color:#FFFFFF" align="center" height="20">
					<td width="4%">No</td><td width="53%">Category</td><td width="23%">Action</td>
				</tr>
				<? if(mysql_num_rows($get_category)==0){ ?>
				<tr valign="top">
					<td align="center" colspan="6">
					- No record found - 
					</td>
				
				<? 
					}
					else
					{
						$no=1;
						while($a=mysql_fetch_array($get_category,MYSQL_ASSOC))
						{
							$enid=en_id($a['id']);
							if($no%2==0)
							{
								$bgcolor="#e5e5e5";
							}
							else
							{
								$bgcolor="#eeeeee";	
							}
							
							
							
				?>
			  <tr height="20" bgcolor="<?= $bgcolor ?>" onmouseover="this.style.backgroundColor='ccccff'" onmouseout="this.style.backgroundColor='<?= $bgcolor ?>'">
						<td align="center"><?= $no ?></td><td><?= $a['name'] ?></td>
						<td align="center"><a href="cat_edit.php?id=<?= $enid ?>">Edit</a> | <a href="cat_delete.php?id=<?= $enid ?>">Delete</a></td>								
			  </tr>
				<? 
					$no++; 
						}
					}
				?>
				
			</table>
		</td>
	</tr>
	<tr>
		<td>
		<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
		<table>
			<tr>
				<td colspan="3"><strong>Add New Cuisine</strong></td>
			</tr>
			<tr>
				<td>Cuisine name</td><td>:</td><td><input class="text" type="text" name="cuisine" size="30"></td>
			</tr>
			<tr>
				<td>Show</td><td>:</td>
				<td>
					<select name="to_show">
						<option value="1">Yes</option>
						<option value="0">No</option>
					</select><br>
				</td>
			</tr>
			
			<tr>
				<td colspan="3"><input type="submit" value="Submit" class="button" name="btnsubmit"></td>
			</tr>
		</table>
		</form>
		</td>
	</tr>
</table>
<? require("required/footer.php"); ?>

